<template>
  <div>
    <table-ext :columns="columns" :searchForm="searchForm" :config="config" ref="tableExt">
    </table-ext>
  </div>
</template>
<script>
   import TableExt from '@/components/common/table-ext/table-ext.vue';
   import TableIcon from '@/components/common/table-ext/table-icon';
   import SelectTree from '@/components/common/select-ext/select-tree.vue';
   export default {
    // 引入自定义表格组件
    components:{
      'table-ext': TableExt,
       SelectTree,
    },
    data() {
      return {
        config:{ // 页面共通配置
          title: '开发申请', //页面标题
          isPage: true, //是否分页
          isNo: true, //是否显示序号
          selection: true, //是否显示复选框
          crudMapping:{ // CRUD方法
            query:{
              url: this.lib.config.host.vendorDlv + "/vendormgt/dlv/dlvApply/findForVendor",
              data:{'vendorId': this.$route.query.id},
              resultFun(response) { // 修改返回默认值
                return {
                  list: response.data, //返回列表数据
                  total: response.data.total //返回总数
                };
              }
            }
          }
        },
        // 查询表单配置
        searchForm:[{
          label: '采购组织：',
          key: 'purOrgId',
          type: 'select',
          dict: {
            url: this.lib.config.host.masterData + '/system/purOrgMgt/purOrg/getPurOrgByUserId/' + this.getCurrUserId(),
            method: 'get',
            label: 'purOrgName',
            value: 'id'
          }
        },{
          label: '采购组：',
          key: 'purGroupId',
          type: 'select',
          dict: {
            url: this.lib.config.host.masterData + '/mdata/purOrgMgt/purGroup/getByPurOrgId/{purOrgId}',
            method: 'post',
            label: 'purGroupName',
            value: 'id'
          }
        },{
          label: '申请主题：',
          key: 'title',
          type: 'input'
        },{
            label: '品类:',
            key: 'categoryCode',
            type: 'select-tree'
        }],
        // 表格列定义
        columns:[{
          label: '采购组织',
          key: 'dlvApply.purOrgName',
          width:'180',
          align:'center',
        },{
          label: '采购组',
          key: 'dlvApply.purGroupName',
          align:'center',
        },{
          label: '申请号',
          key: 'dlvApply.applyNo',
          align:'center',
          order:true,
        },{
          label: '申请主题',
          key: 'dlvApply.title',
          width:'200',
          align:'center',
        },{
          label: '引入类型',
          key: 'applyType',
          width:'250',
          align:'center',
          render:(createElement, params)=>{ //动态渲染, 字典表示例
            if(params.row.applyType == 1){
              return createElement('div','新供应商');
            } else {
              return createElement('div','合格供应商-新物料开发');
            }
          }
        },{
          label: '提交时间',
          key: 'dlvApply.submitTime',
          width:'200',
          align:'center',
        },{
          label: '品类名称',
          key: 'dlvApply.categoryName',
          align:'center',
        },{
          label: '是否工厂考察评估',
          key: 'inspectFlag',
          width:'80',
          align:'center',
          render:(createElement, params)=>{ //动态渲染, 字典表示例
            return createElement(TableIcon,{props:{
                flag: params.row.inspectFlag,
                titles: [{status:0,title:'否'},{status:1,title:'是'}]
            }});
          }
        }]
      };
    },
    methods: {
  
    }
  }
</script>